All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.naming.CompositeName

java.lang.Object
   |
   +----java.naming.CompositeName

public class CompositeName
extends Object
implements Cloneable, Name
The CompositeName class represents a composite name -- a sequence of component names spanning multiple namespaces. Each component is a string name from the namespace of a naming system. If the component comes from a hierarchical namespace, that component can be further parsed into its atomic parts by using the CompoundName class. The components of a composite name are numbered. The indexes of a composite name with N components range from 0 up to, but not including, N. This range may be written as [0,N). An empty composite name has no components.


Constructor Index

 o CompositeName()
Constructs a new empty composite name.
 o CompositeName(String)
Constructs a new composite name instance by parsing the string n using the composite name syntax (left-to-right, slash separated).
 o CompositeName(StringEnumeration)

Method Index

 o appendComponent(String)
Adds a single component to the end of this composite name.
 o appendName(Name)
Adds the components of a composite name -- in order -- to the end of this composite name.
 o clone()
Generates a copy of this composite name.
 o deleteComponent(int)
Deletes a component from this composite name.
 o equals(Object)
Determines whether two composite names are equal.
 o getComponent(int)
Retrieves a component of this composite name.
 o getComponentCount()
Retrieves the number of components in this composite name.
 o getComponents()
Retrieves the components of this composite name as an enumeration of strings.
 o getPrefix(int)
Retrieves a composite name whose components consist of a prefix of the components in this composite name.
 o getSuffix(int)
Retrieves a composite name whose components consist of a suffix of the components in this composite name.
 o hashCode()
Computes the hash code of this composite name.
 o insertComponent(int, String)
Adds a single component at a specified position within this composite name.
 o insertName(int, Name)
Adds the components of a composite name -- in order -- at a specified position within this composite name.
 o isEmpty()
Determines whether this composite name is empty.
 o isPrefix(Name)
Determines whether a composite name is a prefix of this composite name.
 o isSuffix(Name)
Determines whether a composite name is a suffix of this composite name.
 o prependComponent(String)
Adds a single component to the start of this composite name.
 o prependName(Name)
Adds the components of a composite name -- in order -- to the beginning of this composite name.
 o toString()
Generates the string representation of this composite name.

Constructors

 o CompositeName
 protected CompositeName(StringEnumeration comps)
 o CompositeName
 public CompositeName(String n) throws InvalidNameException
Constructs a new composite name instance by parsing the string n using the composite name syntax (left-to-right, slash separated).

Parameters:
n - The string to parse.
 o CompositeName
 public CompositeName()
Constructs a new empty composite name.

Methods

 o toString
 public String toString()
Generates the string representation of this composite name.

Returns:
A string representation of this composite name.
Overrides:
toString in class Object
 o equals
 public boolean equals(Object obj)
Determines whether two composite names are equal. Two composite names are equal if each component in one is equal to the corresponding component in the other.

Parameters:
obj - The object to compare against.
Returns:
true if obj is equal to this composite name, false otherwise.
Overrides:
equals in class Object
 o hashCode
 public int hashCode()
Computes the hash code of this composite name.

Returns:
The hash code computed using characters from this composite name.
Overrides:
hashCode in class Object
 o clone
 public Object clone()
Generates a copy of this composite name.

Returns:
A copy of this composite name.
Overrides:
clone in class Object
 o getComponentCount
 public int getComponentCount()
Retrieves the number of components in this composite name.

Returns:
The number of components in this composite name.
 o isEmpty
 public boolean isEmpty()
Determines whether this composite name is empty.

Returns:
true if this composite name is empty, false otherwise.
 o getComponents
 public StringEnumeration getComponents()
Retrieves the components of this composite name as an enumeration of strings.

Returns:
An enumeration of the components of this composite name.
 o getComponent
 public String getComponent(int posn)
Retrieves a component of this composite name.

Parameters:
posn - The 0-based index of the component to retrieve. Must be in the range [0,getComponentCount()).
Returns:
The component at index posn.
 o getPrefix
 public Name getPrefix(int posn)
Retrieves a composite name whose components consist of a prefix of the components in this composite name.

Parameters:
posn - The 0-based index of the component at which to stop. Must be in the range [0,getComponentCount()].
Returns:
A composite name consisting of the components at indexes in the range [0,posn).
 o getSuffix
 public Name getSuffix(int posn)
Retrieves a composite name whose components consist of a suffix of the components in this composite name.

Parameters:
posn - The 0-based index of the component at which to start. Must be in the range [0,getComponentCount()].
Returns:
A composite name consisting of the components at indexes in the range [posn,getComponentCount()). If posn is equal to getComponentCount(), an empty composite name is returned.
 o isPrefix
 public boolean isPrefix(Name n)
Determines whether a composite name is a prefix of this composite name. A composite name 'n' is a prefix if it is equal to getPrefix(n.getComponentCount()).

Parameters:
n - The composite name to check.
Returns:
true if n is a prefix of this composite name, false otherwise.
 o isSuffix
 public boolean isSuffix(Name n)
Determines whether a composite name is a suffix of this composite name. A composite name 'n' is a suffix if it it is equal to getSuffix(getComponentCount()-n.getComponentCount()).

Parameters:
n - The composite name to check.
Returns:
true if n is a suffix of this composite name, false otherwise.
 o prependName
 public void prependName(Name prefix) throws InvalidNameException
Adds the components of a composite name -- in order -- to the beginning of this composite name.

Parameters:
prefix - The components to add.
 o appendName
 public void appendName(Name suffix) throws InvalidNameException
Adds the components of a composite name -- in order -- to the end of this composite name.

Parameters:
suffix - The components to add.
 o insertName
 public void insertName(int posn,
                        Name n) throws InvalidNameException
Adds the components of a composite name -- in order -- at a specified position within this composite name. Components of this composite name at or after the index of the first new component are shifted to accommodate the new components.

Parameters:
n - The components to add.
posn - The index in this name at which to add the new components. Must be in the range [0,getComponentCount()].
 o prependComponent
 public void prependComponent(String comp) throws InvalidNameException
Adds a single component to the start of this composite name.

Parameters:
comp - The component to add.
 o appendComponent
 public void appendComponent(String comp) throws InvalidNameException
Adds a single component to the end of this composite name.

Parameters:
comp - The component to add.
 o insertComponent
 public void insertComponent(int posn,
                             String comp)
Adds a single component at a specified position within this composite name. Components of this composite name at or after the index of the new component are shifted by one to accommodate the new component.

Parameters:
comp - The component to add.
posn - The index at which to add the new component. Must be in the range [0,getComponentCount()].
 o deleteComponent
 public void deleteComponent(int posn) throws InvalidNameException
Deletes a component from this composite name.

Parameters:
posn - The index of the component to delete. Must be in the range [0,getComponentCount()].

All Packages  Class Hierarchy  This Package  Previous  Next  Index